package com.tiantianfresh.admin.service.Impl;

import com.tiantianfresh.admin.service.CommodityAllocationService;
import com.tiantianfresh.model.dao.CommodityAllocationMapper;
import com.tiantianfresh.model.pojo.CommodityAllocation;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author FANGAO
 * @date 2021/12/23 - 下午 23:00
 */
@Service
public class CommodityAllocationServiceImpl implements CommodityAllocationService {
    @Resource
    private CommodityAllocationMapper commodityAllocationMapper;

    @Override
    public List<CommodityAllocation> queryCommodityAllocationAll(Integer comid) {
        return commodityAllocationMapper.queryCommodityAllocationAll(comid);
    }

    @Override
    public boolean insertCommodity(CommodityAllocation commodityAllocation) {
        if (commodityAllocationMapper.addAllocation(commodityAllocation)>0)return true;
        return false;
    }

    @Override
    public boolean updateCommodity(CommodityAllocation commodityAllocation) {
        if (commodityAllocationMapper.updateAllocation(commodityAllocation)>0)return true;
        return false;
    }

    @Override
    public boolean updateState(CommodityAllocation commodityAllocation) {
        if (commodityAllocationMapper.updateState(commodityAllocation)>0)return true;
        return false;
    }
}
